package com.iot.device.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iot.device.mapper.QuakeEventMapper;
import com.iot.device.domain.QuakeEvent;
import com.iot.device.service.IQuakeEventService;

/**
 * 震动监测预警事件Service业务层处理
 * 
 * @author iot
 * @date 2023-04-14
 */
@Service
public class QuakeEventServiceImpl implements IQuakeEventService 
{
    @Autowired
    private QuakeEventMapper quakeEventMapper;

    /**
     * 查询震动监测预警事件
     * 
     * @param id 震动监测预警事件主键
     * @return 震动监测预警事件
     */
    @Override
    public QuakeEvent selectQuakeEventById(Long id)
    {
        return quakeEventMapper.selectQuakeEventById(id);
    }

    /**
     * 查询震动监测预警事件列表
     * 
     * @param quakeEvent 震动监测预警事件
     * @return 震动监测预警事件
     */
    @Override
    public List<QuakeEvent> selectQuakeEventList(QuakeEvent quakeEvent)
    {
        return quakeEventMapper.selectQuakeEventList(quakeEvent);
    }

    /**
     * 新增震动监测预警事件
     * 
     * @param quakeEvent 震动监测预警事件
     * @return 结果
     */
    @Override
    public int insertQuakeEvent(QuakeEvent quakeEvent)
    {
        return quakeEventMapper.insertQuakeEvent(quakeEvent);
    }

    /**
     * 修改震动监测预警事件
     * 
     * @param quakeEvent 震动监测预警事件
     * @return 结果
     */
    @Override
    public int updateQuakeEvent(QuakeEvent quakeEvent)
    {
        return quakeEventMapper.updateQuakeEvent(quakeEvent);
    }

    /**
     * 批量删除震动监测预警事件
     * 
     * @param ids 需要删除的震动监测预警事件主键
     * @return 结果
     */
    @Override
    public int deleteQuakeEventByIds(Long[] ids)
    {
        return quakeEventMapper.deleteQuakeEventByIds(ids);
    }

    /**
     * 删除震动监测预警事件信息
     * 
     * @param id 震动监测预警事件主键
     * @return 结果
     */
    @Override
    public int deleteQuakeEventById(Long id)
    {
        return quakeEventMapper.deleteQuakeEventById(id);
    }

    @Override
    public int batchInsertAlertEvent(List<QuakeEvent> eventList) {
        return quakeEventMapper.batchInsertAlertEvent(eventList);
    }

    @Override
    public List<Map<String, Long>> selectQuakeEventRankByClient(Long userId, Long limit) {
        return quakeEventMapper.selectQuakeEventRankByClient(userId, limit);
    }

    @Override
    public List<QuakeEvent> selectRecentQuakeEventList(Long userId, Long limit) {
        return quakeEventMapper.selectRecentQuakeEventList(userId, limit);
    }
}
